<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
    <title>编辑用户</title>
    <link href="../layui-v2.5.6/css/layui.css" rel="stylesheet">
</head>
<body>
<body>
<form action="" class="layui-form layui-form-pane" id="saveForm" lay-filter="saveForm" method="post"
      style="margin: 1%;">
    <input id="id" name="id" style="display: none;" value="${user.id!}"/>
    <div class="layui-form-item">
        <label class="layui-form-label" title="用户名">用户名</label>
        <div class="layui-input-inline">
            <input autocomplete="off" class="layui-input" id="userName" lay-verify="required" name="userName"
                   type="text"
                   value="${user.userName!}"/>
        </div>
        <label class="layui-form-label" title="密码">密码</label>
        <div class="layui-input-inline">
            <input autocomplete="off" class="layui-input" id="passWord" lay-verify="required" name="passWord"
                   type="text"
                   value="${user.passWord!}"/>
        </div>
    </div>
<!--    <div class="layui-form-item">-->
<!--        <label class="layui-form-label" title="角色">角色</label>-->
<!--        <div class="layui-input-block">-->
<!--            <#list roleList as role>-->
<!--                <input lay-skin="primary" name="roleList[${role_index}].id" title="${role.roleName}" type="checkbox"-->
<!--                       value="${role.id}"-->
<!--                        <#if user.roleList?? && user.roleList?seq_contains(role)> checked <#else> unchecked </#if> >-->
<!--            </#list>-->
<!--        </div>-->
<!--    </div>-->
    <div class="layui-form-item" style="text-align: center;">
        <div class="layui-inline">
            <button class="layui-btn" lay-filter="save" lay-submit="" style="width: 200px;">保存</button>
        </div>
    </div>
</form>
</body>
<script src="../jquery/jquery-3.4.1.js"></script>
<script src="../layui-v2.5.6/layui.js"></script>
<script type="text/javascript">
    $(function () {
        layui.use(['form'], function () {
            var form = layui.form;
            var layer = layui.layer;
            form.on('submit(save)', function (data) {
                $.ajax({
                    type: "POST",
                    data:data.field,
                    url: "save",
                    success: function (data) {
                        if (data.status == 0) {
                            layer.alert(data.message, function () {
                                layer.closeAll();
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.layer.close(index);
                            });
                        } else {
                            layer.alert(data.message);
                        }
                    },
                    error: function (data) {
                        layer.alert("操作请求错误，请您稍后再试");
                    }
                });
                return false;
            });
        });
    })
</script>
</html>